/**
 * \class IntExp AbsSyn/IntExp.h
 *
 *  Created on: 1 apr 2011
 *      Author: ytc0039
 *
 *  \brief Integer expression
 *
 *  An integer expression is an exprerssion which constitutes of just an constant integer
 *  number like 1,2,3,-1,55 aso.
 *
 *  \ingroup AbsSyn
 *  \ingroup Expressions
 */

#ifndef INTEXP_H_
#define INTEXP_H_

#include <Interfaces/IExp.h>
#include <string>
#include <AbsSyn/AbsSyn.h>

class IntExp: public IExp {
public:

	/**
	 * \brief Type definition for Int expression generation function
	 */

	typedef AbsSyn::IExpPtr (*genIntExp)();

	/**
	 *
	 * \brief Integer expression construtor
	 *
	 * Creates a integer expression
	 * @param num
	 */

	IntExp(int num);
	/**
	 * \brief destructor
	 *
	 */
	virtual ~IntExp();

	/**
	 * \brief visitor implementation
	 *
	 * @see IExpVisitable
	 * Also check out
	 * @see IExpVisitor to implement visitor pattern for expressions.
	 *
	 * @param v visitor VisitIntExp will be called
	 */
	virtual void accept(IExpVisitor *v);

	/**
	 *
	 * @return
	 */
	virtual IntExp* clone() const;

	/**
	 * \brief Implements IPrintable
	 *
	 *  @see IPrintable
	 * @return string representation of IntExp
	 */
	virtual std::string toString() const;

	/**
	 * \brief Generates a new Int Expression.
	 *
	 * Generates a new int expression, and returns a shared_ptr to
	 * that expression.
	 *
	 * @see AbsSyn::IExpPtr
	 *
	 * \return AbsSyn::IExpPtr
	 */
	static AbsSyn::IExpPtr generateIntExp();

	/**
	 * \brief returns the int.
	 *
	 * @return value of the expression
	 */
	int getInt() const;

	/**
	 * \brief set the expression value
	 *
	 *
	 * @param num
	 */
	void setInt(int num);

	bool operator==( const IntExp& rhs);
	bool operator!=( const IntExp& rhs);
private:
	int m_num;
	static std::string isTerminal();
};

#endif /* INTEXP_H_ */
